version			14
clear			all
set				more off

/* THE FILE GENERATES FIGURE I PANELS C-D OF WASEEM (2019) RESTAT */

matrix 			input tax_rates=(0.5 ,1   ,   2,  3,  4,  5,7.5,10 ,12.5,15,19,21  ,  25, 0, 0, 0  ,    0,   0, 0, 0\						///
								 0.25,0.5 ,0.75,1.5,2.5,3.5,4.5,6  , 7.5, 9,10,11  ,12.5,14,15,16  , 17.5,18.5,19,20\						///	
								 0.5 ,0.75,1.5 ,2.5,3.5,4.5,6  ,7.5,   9,10,11,12.5,	 14,15,16,17.5,	18.5,  19,20, 0\						///
								 1.5 ,2.5,3.5,4.5,6  ,7.5,   9,10,11,12.5,	 14,15,16,17.5,	18.5,  20, 0,0,0,0)

set				obs 7000
g				taxableinc=_n/10
expand			6
sort			taxableinc
egen			year=fill(2006 2007 2008 2009 2010 2011 2006 2007 2008 2009 2010 2011)
g				tau=0
local 			i=1
foreach 		z in 150 200 250 300 350 400 500 600 700 850 950 1050 1200 1500 1700 2000 3150 3700 4450 8400 {
					replace tau=tax_rates[2,`i'] if taxableinc > (`z') & (year==2006 | year==2007)
					local i=`i'+1
}
local 			i=1
foreach 		z in 180 250 350 400 450 550 650 750 900 1050 1200 1450 1700 1950 2250 2850 3550 4550 8650 {
					replace tau=tax_rates[3,`i'] if taxableinc > (`z') & (year==2008  | year==2009 | year==2010)
					local i=`i'+1
}
local 			i=1
foreach 		z in 350 400 450 550 650 750 900 1050 1200 1450 1700 1950 2250 2850 3550 4550 {
					replace tau=tax_rates[4,`i'] if taxableinc > (`z') & year==2011
					local i=`i'+1
}
replace  		tau=0.5  if taxableinc >200  & taxableinc<=250  & year==2009
replace  		tau=0  if taxableinc <= 200 & year==2009
replace  		tau=0  if taxableinc <= 300  & year==2010
replace  		tau=0  if taxableinc <= 350 & year==2011
replace 		tau=. if taxableinc==.
replace 		tau=0 if taxableinc<=0
replace			tau=tau/100
reshape 		wide tau, i(taxableinc) j(year)
forvalues		y=2006/2010 {
				local fy=`y'+1
				local m=substr("`fy'",3,2)
				g delnetoft`m'=(((1-tau`fy')-(1-tau`y'))/(1-tau`y'))*100
}

/* 2008 */

g				low08=0
g				high08=delnetoft08 if taxableinc>150 & taxableinc<=180

#d				;
twoway  		(rarea low08 high08 taxableinc if taxableinc>150 & taxableinc<=180, sort color(ltblue) legend(off))
				(line  delnetoft08 taxableinc,sort clcolor(maroon) mcolor(maroon) msymbol(O) lwidth(thick) legend(off)),
				xtitle(Taxable Income in PKR 000s) xtitle(, alignment(top))
				xlabel(0(100)700)
				ytitle(Change in Net-of-tax Rate (%)) yscale(titlegap(*10))
				ylabel(-0.5(0.5)1.5)
				graphregion(fcolor(white) style(none) color(white) margin(0 2 0 2)) bgcolor(white);
graph 			export "$project_graph\FigureIPanelC.eps", replace;
#d 				cr

/* 2009 */

g				low09=0
g				high09=delnetoft09 if taxableinc>180 & taxableinc<=200

#d				;
twoway  		(rarea low09 high09 taxableinc if taxableinc>180 & taxableinc<=200, sort color(ltblue) legend(off))
				(line  delnetoft09 taxableinc,sort clcolor(maroon) mcolor(maroon) msymbol(O) lwidth(thick) legend(off)),
				xtitle(Taxable Income in PKR 000s) xtitle(, alignment(top))
				xlabel(0(100)700)
				ytitle(Change in Net-of-tax Rate (%)) yscale(titlegap(*10))
				ylabel(-0.5(0.5)1.5)
				graphregion(fcolor(white) style(none) color(white) margin(0 2 0 2)) bgcolor(white);
graph 			export "$project_graph\FigureIPanelD.eps", replace;
#d 				cr

/* 2010 */

g				low10=0
g				high10=delnetoft10 if taxableinc>200 & taxableinc<=300

#d				;
twoway  		(rarea low10 high10 taxableinc if taxableinc>200 & taxableinc<=300, sort color(ltblue) legend(off))
				(line  delnetoft10 taxableinc,sort clcolor(maroon) mcolor(maroon) msymbol(O) lwidth(thick) legend(off)),
				xtitle(Taxable Income in PKR 000s) xtitle(, alignment(top))
				xlabel(0(100)700)
				ytitle(Change in Net-of-tax Rate (%)) yscale(titlegap(*10))
				ylabel(-0.5(0.5)1.5)
				graphregion(fcolor(white) style(none) color(white) margin(0 2 0 2)) bgcolor(white);
graph 			export "$project_graph\FigureIPanelE.eps", replace;
#d 				cr

/* 2011 */

g				low11=0
g				high11=delnetoft11 if taxableinc>300 & taxableinc<=350

#d				;
twoway  		(rarea low11 high11 taxableinc if taxableinc>300 & taxableinc<=350, sort color(ltblue) legend(off))
				(line  delnetoft11 taxableinc,sort clcolor(maroon) mcolor(maroon) msymbol(O) lwidth(thick) legend(off)),
				xtitle(Taxable Income in PKR 000s) xtitle(, alignment(top))
				xlabel(0(100)700)
				ytitle(Change in Net-of-tax Rate (%)) yscale(titlegap(*10))
				ylabel(-0.5(0.5)1.5)
				graphregion(fcolor(white) style(none) color(white) margin(0 2 0 2)) bgcolor(white);
graph 			export "$project_graph\FigureIPanelF.eps", replace;
#d 				cr
